package com.ljye.jg.ljye.activity;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.ImageView;

import com.ljye.jg.ljye.R;
import com.ljye.jg.ljye.adapter.ViewPagerAdapter;
import com.ljye.jg.ljye.fragment.Fragment_Circle_1;
import com.ljye.jg.ljye.fragment.Fragment_my_integral2;
import com.ljye.jg.ljye.layout.NavitationLayout;

import java.util.ArrayList;
import java.util.List;

public class Activity_Circle_Management extends FragmentActivity {
    public View.OnClickListener listener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            switch (view.getId()) {
                case R.id.back://返回
                    finish();
                    break;
                default:
                    break;
            }
        }
    };
    private ImageView back;//返回
    private String[] titles1 = new String[]{"热门话题", "老师圈子"};
    private NavitationLayout navitationLayout;//title
    private ViewPager viewPager2;//viewpager
    private ViewPagerAdapter viewPagerAdapter;//适配器
    private List<Fragment> fragments;//集合

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_circle_management);
        initView();
        initPager();
        back.setOnClickListener(listener);

    }

    private void initPager() {
        fragments = new ArrayList<>();
        fragments.add(new Fragment_Circle_1());
        fragments.add(new Fragment_my_integral2());
        viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager(), fragments);
        viewPager2.setAdapter(viewPagerAdapter);
        //上下文        标题栏    ViewPager 未选中字体颜色         选中字体颜色          未选中字体大小 选中字体大小 当前viewpager的位置  导航条的边距 是否开启滑动
        navitationLayout.setViewPager(Activity_Circle_Management.this, titles1, viewPager2, R.color.black, R.color.activity_title_color, 13, 13, 0, 40, true);
        navitationLayout.setBgLine(Activity_Circle_Management.this, 1, R.color.white); //导航背景色
        navitationLayout.setNavLine(Activity_Circle_Management.this, 2, R.color.activity_title_color, 0);//导航条颜色
    }

    private void initView() {
        back = (ImageView) findViewById(R.id.back);
        viewPager2 = (ViewPager) findViewById(R.id.viewpager2);
        navitationLayout = (NavitationLayout) findViewById(R.id.bar1);


    }
}
